Compiling
This page contains help on compiling NetHack from source. On Windows This was tested on: - Win2k with MinGW-5.0.3, - WinXP with MinGW-5.1.1, *Download NetHack's sources from http://nethack.org/v343/download-src.html *Download MinGW from http://sourceforge.net/project/showfiles.php?group_id=2435 (You want the MinGW-X.Y.Z.exe installer) *Install MinGW. If you use the 'minimal' installation, remember to also select the optional 'MinGW make' -component, so it gets installed. Use, say, C:\mingw\ as the path to install to. *Unpack the NetHack source package somewhere, say, c:\nh343\. After unpacking, that directory should contain several subdirectories, such as src, include, win and sys. You will need WinZip or some other utility that can uncompress the package. *Go to c:\nh343\sys\winnt\ and run nhsetup.bat *If you want to run the graphical windows GUI, edit c:\nh343\src\makefile.gcc and change the line #GRAPHICAL=Y to GRAPHICAL=Y *Go to c:\nh343\ and create a new file called 'install.bat' with the following contents: PATH=c:\mingw\bin cd src mingw32-make -f makefile.gcc install *Run the install.bat you just created. This takes about thirty seconds. *The NetHack binary should now be in c:\nh343\binary\ *If you want to patch your NetHack, you should next see the article on patching. On Linux TTY The following compiles the TTY-version of NetHack, with all the default settings. *Download NetHack's sources from http://nethack.org/v343/download-src.html *Make sure you have the development packages for ncurses installed. On debian these are called libncurses5-dev. *Open a terminal, and cd to the directory where you downloaded the source package to. *Unpack the NetHack sources and move to the NetHack source root directory: tar xvzf nethack-343-src.tgz cd nethack-3.4.3 *Execute the script that moves the Makefiles to the correct places: sh sys/unix/setup.sh x *Edit include/unixconf.h by changing /* #define LINUX */ to #define LINUX *Edit src/Makefile by changing WINTTYLIB = -ltermlib to WINTTYLIB = -lncurses *Typing make in the NetHack source root dir should compile the binary executable. *To install NetHack to /usr/games/, type make install while you're logged in as root. If you want to change the installation directory, you need to edit the top Makefile. *For more information about compiling NetHack, see the sys/unix/Install.unx text file. *If you want to patch your NetHack, you should next see the article on patching. X11 The following compiles the X11 windowport with default settings. First follow the instructions in the TTY section, then continue this. *Make sure you have the X11 Athena Widget libraries and headers installed. On Debian these are libxaw, libxaw-dev and libxaw-headers. *Edit include/config.h by changing /* #define X11_GRAPHICS */ to #define X11_GRAPHICS and /* # define USE_XPM */ to # define USE_XPM *Edit src/Makefile: **add $(WINX11SRC) to WINSRC, $(WINX11OBJ) to WINOBJ and $(WINX11LIB) to WINLIB. **Change WINX11LIB so that it has -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm **At least on debian, WINX11LIB also needs -L/usr/X11R6/lib *Edit Makefile so that VARDATND includes x11tiles NetHack.ad pet_mark.xbm rip.xpm *Type make in the NetHack source root dir. *To install NetHack to /usr/games/, type make install while you're logged in as root. If you want to change the installation directory, you need to edit the top Makefile. *For more information about compiling NetHack, see the sys/unix/Install.unx text file. For X11 compilation, see win/X11/Install.X11 *If you want to patch your NetHack, you should next see the article on patching. *If you want to use tiles on X11, or change the window colors, see the article on X11 configuration. Category:Development